package com.atguigu.crowd.mvc.handler;

import com.atguigu.crowd.entity.Admin;
import com.atguigu.crowd.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author yzt
 * @create 2021-09-09 23:37
 */
@Controller
public class TestHandler {

    @Autowired
    private AdminService adminService;

    @RequestMapping("/test/ssm")
    public String testSSM(Model model){
        List<Admin> adminList=adminService.getAll();
        model.addAttribute("adminList",adminList);
        System.out.println(10/0);
        return "target";
    }

    @ResponseBody
    @RequestMapping("/test/ajax")
    public String ajax1(){
        return "Ajax异步请求";
    }

}
